
fastlane_version "2.41.0"

default_platform :ios

platform :ios do
   lane :ci do|options|
    branch = options[:branch]
    build_no = get_version_number + '.' + Time.new.strftime("%m%d%H%M")

    puts "Begin to run ci"

    #确认分支、git状态、拉取最新代码
    sh "git checkout #{branch}"
    ensure_git_branch(branch: branch)
    ensure_git_status_clean
    git_pull

    #递增build number
    increment_build_number(build_number: build_no)

    #开始打包
    gym(
      export_method:"development",
      output_directory:"./fastlane/build",
    )

    #使用fir-cli上传ipa
    sh "fir publish ./build/MyTestDemo.ipa -T d741ac220ae1ae6bb7ecd5590714b21f"
  end
end